<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of tt_mkron</title>
  <meta name="keywords" content="tt_mkron">
  <meta name="description" content="Compute Kronecker product of many TT-tensors.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../index.html">Home</a> &gt;  <a href="#">tt2</a> &gt; <a href="index.html">core</a> &gt; tt_mkron.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../index.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for tt2/core&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>tt_mkron
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>Compute Kronecker product of many TT-tensors.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function [res]=tt_mkron(tt_arr) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment">Compute Kronecker product of many TT-tensors. 
   [RES]=TT_MKRON(TT_ARR) Computes Kronecker product of many TT tensors
   TT_ARR is a cell array of TT tensors, and the result RES is the 
   Kronecker product of them. It is much faster, then taking them
   one-by-one. Works in TT1.0 format (still).


 TT-Toolbox 2.2, 2009-2012

This is TT Toolbox, written by Ivan Oseledets et al.
Institute of Numerical Mathematics, Moscow, Russia
webpage: http://spring.inm.ras.ru/osel

For all questions, bugs and suggestions please mail
ivan.oseledets@gmail.com
---------------------------</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>	Mode sizes of the TT-matrix</li><li><a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>	Reshape of the TT-tensor</li><li><a href="../../tt2/@tt_tensor/size.html" class="code" title="function [sz] = size(tt,dim)">size</a>	Mode sizes of the TT-tensor</li></ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="../../tt2/exp/canm_to_qtt.html" class="code" title="function [tt]=canm_to_qtt(can,rmax,eps)">canm_to_qtt</a>	Converts a canonical representation to QTT-format</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [res]=tt_mkron(tt_arr)</a>
0002 <span class="comment">%Compute Kronecker product of many TT-tensors.</span>
0003 <span class="comment">%   [RES]=TT_MKRON(TT_ARR) Computes Kronecker product of many TT tensors</span>
0004 <span class="comment">%   TT_ARR is a cell array of TT tensors, and the result RES is the</span>
0005 <span class="comment">%   Kronecker product of them. It is much faster, then taking them</span>
0006 <span class="comment">%   one-by-one. Works in TT1.0 format (still).</span>
0007 <span class="comment">%</span>
0008 <span class="comment">%</span>
0009 <span class="comment">% TT-Toolbox 2.2, 2009-2012</span>
0010 <span class="comment">%</span>
0011 <span class="comment">%This is TT Toolbox, written by Ivan Oseledets et al.</span>
0012 <span class="comment">%Institute of Numerical Mathematics, Moscow, Russia</span>
0013 <span class="comment">%webpage: http://spring.inm.ras.ru/osel</span>
0014 <span class="comment">%</span>
0015 <span class="comment">%For all questions, bugs and suggestions please mail</span>
0016 <span class="comment">%ivan.oseledets@gmail.com</span>
0017 <span class="comment">%---------------------------</span>
0018 <span class="keyword">if</span> ( <a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(tt_arr,1) == 1 ) 
0019   tt_arr=tt_arr';
0020 <span class="keyword">end</span>
0021 N=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(tt_arr,1);
0022 dsz=zeros(N,1);
0023 <span class="keyword">for</span> k=1:N
0024     <span class="keyword">if</span> ( iscell(tt_arr{k}) ) 
0025       dsz(k) = <a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(tt_arr{k},1);
0026     <span class="keyword">else</span>
0027       dsz(k) = 1;     
0028     <span class="keyword">end</span>
0029 <span class="keyword">end</span>
0030 d=sum(dsz(1:N));
0031 res=cell(d,1);
0032 pos=1;
0033 <span class="keyword">for</span> k=1:N
0034   <span class="keyword">for</span> i=1:dsz(k)
0035       <span class="keyword">if</span> ( ~iscell(tt_arr{k}))
0036         res{pos}=tt_arr{k};
0037       <span class="keyword">else</span>
0038      res{pos}=tt_arr{k}{i};
0039       <span class="keyword">end</span>
0040      pos=pos+1;
0041   <span class="keyword">end</span>
0042 <span class="keyword">end</span>
0043 pos=dsz(1)+1;
0044 <span class="keyword">for</span> k=2:N
0045     fx=res{pos};
0046     ncur=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(fx,1); r=<a href="../../tt2/@tt_matrix/size.html" class="code" title="function [sz] = size(tt)">size</a>(fx,2);
0047     res{pos}=<a href="../../tt2/@tt_tensor/reshape.html" class="code" title="function [tt2]=reshape(tt1,sz,eps, rl, rr)">reshape</a>(fx,[ncur,1,r]);
0048     pos = pos + dsz(k);
0049 <span class="keyword">end</span>
0050 
0051 <span class="keyword">return</span>
0052 <span class="keyword">end</span></pre></div>
<hr><address>Generated on Wed 08-Feb-2012 18:20:24 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>